package com.yhcnet.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yhcnet.pojo.File;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface FileMapper extends BaseMapper<File> {

    @Select("select sum(size) from file where uid=#{uid} and deleted = 0 and folder=0")
    int selectSizes(@Param("uid") int uid);

    @Select("select count(fid) from file where uid=#{uid} and deleted = 0 and pid=#{pid}")
    int selectCount(@Param("uid") int uid,@Param("pid") int pid);

    @Select("select count(fid) from file where uid=#{uid} and deleted = 0 and pid=#{pid} and type=#{type}")
    int selectCountByType(@Param("uid") int uid,@Param("pid") int pid,@Param("type") int type);
}
